"""
商业化功能配置文件
"""
import os

# 数据库配置
DB_CONFIG = {
    'host': os.environ.get('HOST'),
    'user': os.environ.get('USER'),
    'password': os.environ.get('PASSWORD'),
    'database': os.environ.get('DATABASE')
}

# 股票交易信号配置
STOCK_CONFIG = {
    'monitor_interval': 300,  # 监控间隔（秒）
    'ma_periods': [5, 10, 20, 30, 60],  # MA均线周期
    'rsi_period': 14,  # RSI周期
    'macd_params': {
        'fastperiod': 12,
        'slowperiod': 26,
        'signalperiod': 9
    },
    'vip_levels': {
        0: {'max_stocks': 5, 'alert_interval': 3600},  # 免费用户
        1: {'max_stocks': 20, 'alert_interval': 1800},  # VIP1
        2: {'max_stocks': 50, 'alert_interval': 300},   # VIP2
        3: {'max_stocks': -1, 'alert_interval': 60}     # VIP3
    }
}

# 短视频分析配置
VIDEO_CONFIG = {
    'platforms': ['douyin', 'kuaishou'],
    'monitor_interval': 1800,  # 30分钟
    'cookies': {
        'douyin': os.environ.get('DOUYIN_COOKIE', ''),
        'kuaishou': os.environ.get('KUAISHOU_COOKIE', '')
    },
    'vip_features': {
        0: ['basic_stats'],  # 免费用户
        1: ['basic_stats', 'competitor_analysis'],  # VIP1
        2: ['basic_stats', 'competitor_analysis', 'trend_prediction'],  # VIP2
        3: ['basic_stats', 'competitor_analysis', 'trend_prediction', 'ai_suggestions']  # VIP3
    }
}

# 电商热销榜配置
ECOMMERCE_CONFIG = {
    'platforms': ['taobao', 'jd', 'pdd'],
    'monitor_interval': 14400,  # 4小时
    'cookies': {
        'taobao': os.environ.get('TAOBAO_COOKIE', ''),
        'jd': os.environ.get('JD_COOKIE', ''),
        'pdd': os.environ.get('PDD_COOKIE', '')
    },
    'vip_levels': {
        0: {'max_products': 10, 'update_interval': 3600},
        1: {'max_products': 50, 'update_interval': 1800},
        2: {'max_products': 200, 'update_interval': 600},
        3: {'max_products': -1, 'update_interval': 300}
    }
}

# 招聘信息分析配置
JOB_CONFIG = {
    'platforms': ['zhipin', 'lagou'],
    'monitor_interval': 14400,  # 4小时
    'vip_features': {
        0: ['salary_range'],
        1: ['salary_range', 'company_info'],
        2: ['salary_range', 'company_info', 'market_analysis'],
        3: ['salary_range', 'company_info', 'market_analysis', 'career_planning']
    }
}

# 房产市场分析配置
HOUSE_CONFIG = {
    'platforms': ['lianjia', 'beike'],
    'monitor_interval': 21600,  # 6小时
    'cities': {
        'beijing': ['朝阳', '海淀', '东城', '西城', '丰台'],
        'shanghai': ['浦东', '徐汇', '静安', '黄浦', '长宁']
    },
    'vip_features': {
        0: ['price_trend'],
        1: ['price_trend', 'investment_analysis'],
        2: ['price_trend', 'investment_analysis', 'market_forecast'],
        3: ['price_trend', 'investment_analysis', 'market_forecast', 'ai_consultant']
    }
}

# 旅游景点分析配置
TRAVEL_CONFIG = {
    'platforms': ['mafengwo', 'ctrip'],
    'monitor_interval': 14400,  # 4小时
    'cities': ['beijing', 'shanghai', 'guangzhou', 'shenzhen'],
    'vip_features': {
        0: ['basic_info'],
        1: ['basic_info', 'review_analysis'],
        2: ['basic_info', 'review_analysis', 'price_tracking'],
        3: ['basic_info', 'review_analysis', 'price_tracking', 'travel_planning']
    }
}

# 通知配置
NOTIFICATION_CONFIG = {
    'channels': {
        'email': {
            'enabled': True,
            'smtp_host': 'smtp.example.com',
            'smtp_port': 587,
            'username': os.environ.get('EMAIL_USER', ''),
            'password': os.environ.get('EMAIL_PASS', '')
        },
        'sms': {
            'enabled': True,
            'api_key': os.environ.get('SMS_API_KEY', ''),
            'template_id': os.environ.get('SMS_TEMPLATE_ID', '')
        },
        'wechat': {
            'enabled': True,
            'app_id': os.environ.get('WECHAT_APP_ID', ''),
            'app_secret': os.environ.get('WECHAT_APP_SECRET', '')
        }
    },
    'vip_limits': {
        0: {'email': 50, 'sms': 0, 'wechat': 0},    # 免费用户
        1: {'email': 200, 'sms': 50, 'wechat': 50},  # VIP1
        2: {'email': 500, 'sms': 200, 'wechat': 200},  # VIP2
        3: {'email': -1, 'sms': -1, 'wechat': -1}    # VIP3
    }
}

# 数据清理配置
CLEANUP_CONFIG = {
    'retention_days': {
        'stock_signals': 30,
        'video_analysis': 90,
        'hot_products': 60,
        'job_analysis': 90,
        'house_analysis': 180,
        'travel_analysis': 90
    },
    'backup_enabled': True,
    'backup_interval': 86400  # 24小时
} 